import torch
import time
print(torch.__version__)
print(torch.cuda.is_available())
a=torch.randn(10000,1000)
b=torch.randn(1000,2000)
t0=time.time()
c=torch.matmul(a,b)
print(a.device,time.time()-t0,c.norm(2))

from  torch import autograd
x=torch.tensor(1.)
a=torch.tensor(1.,requires_grad=True)
b=torch.tensor(2.,requires_grad=True)
c=torch.tensor(3.,requires_grad=True)
y=a**2+b*x+c
print(a.grad,b.grad,c.grad)
grads=autograd.grad(y,[a,b,c])
print(grads[0],grads[1],grads[2])
